package com.mdinic.blogovi.front.common;

import org.apache.wicket.behavior.AttributeAppender;
import org.apache.wicket.markup.html.image.ContextImage;

import com.mdinic.blogovi.model.BlogPost;

public class ThumbPhoto extends ContextImage {

    private static final long serialVersionUID = -6306276388070634424L;

    private static final String NOPHOTO = "thumb.png";

    public ThumbPhoto(String id, BlogPost blogPost) {
        super(id, "/../images/blogovi/thumb/");
        add(new AttributeAppender("src", blogPost.getThumb() == null ? NOPHOTO : blogPost.getThumb()));
    }
}
